package com.program.eneity;

/**
 * @program: AirportSystem
 * @description: 航班实体类
 * @author: 19071027
 * @create: 2021-09-06 18:04
 **/
public class Airplane {

    /**
     * 所属公司
     */
    private String company;

    /**
     * 航班号
     */
    private String id;

    /**
     * 起飞时间
     */
    private Date departureTime;

    /**
     * 降落时间
     */
    private Date landingTime;

    /**
     * 燃油剩余量
     */
    private int fuel;

    public Airplane(String company, String id, Date departureTime, Date landingTime, int fuel) {
        this.company = company;
        this.id = id;
        this.departureTime = departureTime;
        this.landingTime = landingTime;
        this.fuel = fuel;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getDepartureTime() {
        return departureTime;
    }

    public void setDepartureTime(Date departureTime) {
        this.departureTime = departureTime;
    }

    public Date getLandingTime() {
        return landingTime;
    }

    public void setLandingTime(Date landingTime) {
        this.landingTime = landingTime;
    }

    public int getFuel() {
        return fuel;
    }

    public void setFuel(int fuel) {
        this.fuel = fuel;
    }

    public String stateInfo() {
        String info = departureTime == null ? "降落" : "起飞";
        return info;
    }

    @Override
    public String toString() {
        if (landingTime == null) {
            return company + "   " + id + "   " + departureTime;
        }
        return company + "   " + id + "   " + landingTime;
    }
}
